7a333284c215150c8b1bc03374b57b6387e145fa
3 * Include most things that are needed to make %MediaWiki work.
5 * This file is included by WebStart.php and doMaintenance.php so that both
6 * web and maintenance scripts share a final set up phase to include necessary
7 * files and create global object variables.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
28 * This file is not a valid entry point, perform no further processing unless
29 * MEDIAWIKI is defined
31 if ( !defined( 'MEDIAWIKI' ) ) {
36 $ps_setup = Profiler
::instance()->scopedProfileIn( $fname );
38 // If any extensions are still queued, force load them
39 ExtensionRegistry
::getInstance()->loadFromQueue();
41 // Check to see if we are at the file scope
42 if ( !isset( $wgVersion ) ) {
43 echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
47 // Set various default paths sensibly...
48 $ps_default = Profiler
::instance()->scopedProfileIn( $fname . '-defaults' );
50 if ( $wgScript === false ) {
51 $wgScript = "$wgScriptPath/index$wgScriptExtension";
53 if ( $wgLoadScript === false ) {
54 $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
57 if ( $wgArticlePath === false ) {
58 if ( $wgUsePathInfo ) {
59 $wgArticlePath = "$wgScript/$1";
61 $wgArticlePath = "$wgScript?title=$1";
65 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
66 // 'view' is assumed the default action path everywhere in the code
67 // but is rarely filled in $wgActionPaths
68 $wgActionPaths['view'] = $wgArticlePath;
71 if ( $wgStylePath === false ) {
72 $wgStylePath = "$wgScriptPath/skins";
74 if ( $wgLocalStylePath === false ) {
75 $wgLocalStylePath = "$wgScriptPath/skins";
77 if ( $wgExtensionAssetsPath === false ) {
78 $wgExtensionAssetsPath = "$wgScriptPath/extensions";
80 if ( $wgResourceBasePath === null ) {
81 $wgResourceBasePath = $wgScriptPath;
84 if ( $wgLogo === false ) {
85 $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
88 if ( $wgUploadPath === false ) {
89 $wgUploadPath = "$wgScriptPath/images";
91 if ( $wgUploadDirectory === false ) {
92 $wgUploadDirectory = "$IP/images";
94 if ( $wgReadOnlyFile === false ) {
95 $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
97 if ( $wgFileCacheDirectory === false ) {
98 $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
100 if ( $wgDeletedDirectory === false ) {
101 $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
104 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
105 $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
108 // Fix path to icon images after they were moved in 1.24
109 if ( $wgRightsIcon ) {
110 $wgRightsIcon = str_replace(
111 "{$wgStylePath}/common/images/",
112 "{$wgResourceBasePath}/resources/assets/licenses/",
117 if ( isset( $wgFooterIcons['copyright'] )
118 && isset( $wgFooterIcons['copyright']['copyright'] )
119 && $wgFooterIcons['copyright']['copyright'] === array()
121 if ( $wgCopyrightIcon ) {
122 $wgFooterIcons['copyright']['copyright'] = $wgCopyrightIcon;
123 } elseif ( $wgRightsIcon ||
$wgRightsText ) {
124 $wgFooterIcons['copyright']['copyright'] = array(
125 'url' => $wgRightsUrl,
126 'src' => $wgRightsIcon,
127 'alt' => $wgRightsText,
130 unset( $wgFooterIcons['copyright']['copyright'] );
134 if ( isset( $wgFooterIcons['poweredby'] )
135 && isset( $wgFooterIcons['poweredby']['mediawiki'] )
136 && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
138 $wgFooterIcons['poweredby']['mediawiki']['src'] =
139 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
140 $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
141 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
142 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
146 * Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a
147 * sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.
149 * Note that this is the definition of editinterface and it can be granted to
150 * all users if desired.
152 $wgNamespaceProtection[NS_MEDIAWIKI
] = 'editinterface';
155 * The canonical names of namespaces 6 and 7 are, as of v1.14, "File"
156 * and "File_talk". The old names "Image" and "Image_talk" are
157 * retained as aliases for backwards compatibility.
159 $wgNamespaceAliases['Image'] = NS_FILE
;
160 $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK
;
163 * Initialise $wgLockManagers to include basic FS version
165 $wgLockManagers[] = array(
166 'name' => 'fsLockManager',
167 'class' => 'FSLockManager',
168 'lockDirectory' => "{$wgUploadDirectory}/lockdir",
170 $wgLockManagers[] = array(
171 'name' => 'nullLockManager',
172 'class' => 'NullLockManager',
176 * Initialise $wgLocalFileRepo from backwards-compatible settings
178 if ( !$wgLocalFileRepo ) {
179 $wgLocalFileRepo = array(
180 'class' => 'LocalRepo',
182 'directory' => $wgUploadDirectory,
183 'scriptDirUrl' => $wgScriptPath,
184 'scriptExtension' => $wgScriptExtension,
185 'url' => $wgUploadBaseUrl ?
$wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
186 'hashLevels' => $wgHashedUploadDirectory ?
2 : 0,
187 'thumbScriptUrl' => $wgThumbnailScriptPath,
188 'transformVia404' => !$wgGenerateThumbnailOnParse,
189 'deletedDir' => $wgDeletedDirectory,
190 'deletedHashLevels' => $wgHashedUploadDirectory ?
3 : 0
194 * Initialise shared repo from backwards-compatible settings
196 if ( $wgUseSharedUploads ) {
197 if ( $wgSharedUploadDBname ) {
198 $wgForeignFileRepos[] = array(
199 'class' => 'ForeignDBRepo',
201 'directory' => $wgSharedUploadDirectory,
202 'url' => $wgSharedUploadPath,
203 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
204 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
205 'transformVia404' => !$wgGenerateThumbnailOnParse,
206 'dbType' => $wgDBtype,
207 'dbServer' => $wgDBserver,
208 'dbUser' => $wgDBuser,
209 'dbPassword' => $wgDBpassword,
210 'dbName' => $wgSharedUploadDBname,
211 'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG
: 0 ) | DBO_DEFAULT
,
212 'tablePrefix' => $wgSharedUploadDBprefix,
213 'hasSharedCache' => $wgCacheSharedUploads,
214 'descBaseUrl' => $wgRepositoryBaseUrl,
215 'fetchDescription' => $wgFetchCommonsDescriptions,
218 $wgForeignFileRepos[] = array(
219 'class' => 'FileRepo',
221 'directory' => $wgSharedUploadDirectory,
222 'url' => $wgSharedUploadPath,
223 'hashLevels' => $wgHashedSharedUploadDirectory ?
2 : 0,
224 'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
225 'transformVia404' => !$wgGenerateThumbnailOnParse,
226 'descBaseUrl' => $wgRepositoryBaseUrl,
227 'fetchDescription' => $wgFetchCommonsDescriptions,
231 if ( $wgUseInstantCommons ) {
232 $wgForeignFileRepos[] = array(
233 'class' => 'ForeignAPIRepo',
234 'name' => 'wikimediacommons',
235 'apibase' => WebRequest
::detectProtocol() === 'https' ?
236 'https://commons.wikimedia.org/w/api.php' :
237 'http://commons.wikimedia.org/w/api.php',
239 'fetchDescription' => true,
240 'descriptionCacheExpiry' => 43200,
241 'apiThumbCacheExpiry' => 86400,
245 * Add on default file backend config for file repos.
246 * FileBackendGroup will handle initializing the backends.
248 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
249 $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
251 foreach ( $wgForeignFileRepos as &$repo ) {
252 if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
253 $repo['directory'] = $wgUploadDirectory; // b/c
255 if ( !isset( $repo['backend'] ) ) {
256 $repo['backend'] = $repo['name'] . '-backend';
259 unset( $repo ); // no global pollution; destroy reference
261 if ( $wgRCFilterByAge ) {
262 // Trim down $wgRCLinkDays so that it only lists links which are valid
263 // as determined by $wgRCMaxAge.
264 // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
265 sort( $wgRCLinkDays );
267 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
268 for ( $i = 0; $i < count( $wgRCLinkDays ); $i++
) {
269 // @codingStandardsIgnoreEnd
270 if ( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
271 $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i +
1, false );
278 $wgSkipSkins[] = $wgSkipSkin;
282 // Use a closure to avoid leaking into global state
283 call_user_func( function () use ( $wgValidSkinNames ) {
284 $factory = SkinFactory
::getDefaultInstance();
285 foreach ( $wgValidSkinNames as $name => $skin ) {
286 $factory->register( $name, $skin, function () use ( $name, $skin ) {
287 $class = "Skin$skin";
288 return new $class( $name );
291 // Register a hidden "fallback" skin
292 $factory->register( 'fallback', 'Fallback', function () {
293 return new SkinFallback
;
295 // Register a hidden skin for api output
296 $factory->register( 'apioutput', 'ApiOutput', function () {
300 $wgSkipSkins[] = 'fallback';
301 $wgSkipSkins[] = 'apioutput';
303 if ( $wgLocalInterwiki ) {
304 array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
307 // Set default shared prefix
308 if ( $wgSharedPrefix === false ) {
309 $wgSharedPrefix = $wgDBprefix;
312 // Set default shared schema
313 if ( $wgSharedSchema === false ) {
314 $wgSharedSchema = $wgDBmwschema;
317 if ( !$wgCookiePrefix ) {
318 if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
319 $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
320 } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
321 $wgCookiePrefix = $wgSharedDB;
322 } elseif ( $wgDBprefix ) {
323 $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
325 $wgCookiePrefix = $wgDBname;
328 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
330 if ( $wgEnableEmail ) {
331 $wgUseEnotif = $wgEnotifUserTalk ||
$wgEnotifWatchlist;
333 // Disable all other email settings automatically if $wgEnableEmail
334 // is set to false. - bug 63678
335 $wgAllowHTMLEmail = false;
336 $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
337 $wgEnableUserEmail = false;
338 $wgEnotifFromEditor = false;
339 $wgEnotifImpersonal = false;
340 $wgEnotifMaxRecips = 0;
341 $wgEnotifMinorEdits = false;
342 $wgEnotifRevealEditorAddress = false;
343 $wgEnotifUseJobQ = false;
344 $wgEnotifUseRealName = false;
345 $wgEnotifUserTalk = false;
346 $wgEnotifWatchlist = false;
347 unset( $wgGroupPermissions['user']['sendemail'] );
348 $wgUseEnotif = false;
349 $wgUserEmailUseReplyTo = false;
350 $wgUsersNotifiedOnAllChanges = array();
353 // Doesn't make sense to have if disabled.
354 if ( !$wgEnotifMinorEdits ) {
355 $wgHiddenPrefs[] = 'enotifminoredits';
358 if ( $wgMetaNamespace === false ) {
359 $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
362 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
363 if ( $wgResourceLoaderMaxQueryLength === false ) {
364 $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
365 if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
366 $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
368 $wgResourceLoaderMaxQueryLength = 2000;
370 unset($suhosinMaxValueLength);
374 * Definitions of the NS_ constants are in Defines.php
377 $wgCanonicalNamespaceNames = array(
379 NS_SPECIAL
=> 'Special',
382 NS_USER_TALK
=> 'User_talk',
383 NS_PROJECT
=> 'Project',
384 NS_PROJECT_TALK
=> 'Project_talk',
386 NS_FILE_TALK
=> 'File_talk',
387 NS_MEDIAWIKI
=> 'MediaWiki',
388 NS_MEDIAWIKI_TALK
=> 'MediaWiki_talk',
389 NS_TEMPLATE
=> 'Template',
390 NS_TEMPLATE_TALK
=> 'Template_talk',
392 NS_HELP_TALK
=> 'Help_talk',
393 NS_CATEGORY
=> 'Category',
394 NS_CATEGORY_TALK
=> 'Category_talk',
398 if ( is_array( $wgExtraNamespaces ) ) {
399 $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames +
$wgExtraNamespaces;
402 // These are now the same, always
403 // To determine the user language, use $wgLang->getCode()
404 $wgContLanguageCode = $wgLanguageCode;
406 // Easy to forget to falsify $wgShowIPinHeader for static caches.
407 // If file cache or squid cache is on, just disable this (DWIMD).
408 // Do the same for $wgDebugToolbar.
409 if ( $wgUseFileCache ||
$wgUseSquid ) {
410 $wgShowIPinHeader = false;
411 $wgDebugToolbar = false;
414 // We always output HTML5 since 1.22, overriding these is no longer supported
415 // we set them here for extensions that depend on its value.
417 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
418 $wgJsMimeType = 'text/javascript';
420 if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
421 // see http://www.w3.org/TR/rdfa-in-html/#document-conformance
422 if ( $wgMimeType == 'application/xhtml+xml' ) {
423 $wgHtml5Version = 'XHTML+RDFa 1.0';
425 $wgHtml5Version = 'HTML+RDFa 1.0';
429 // Blacklisted file extensions shouldn't appear on the "allowed" list
430 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
432 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
433 // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
434 $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime
( "$IP/LocalSettings.php" ) ) );
435 // @codingStandardsIgnoreEnd
438 if ( $wgNewUserLog ) {
439 // Add a new log type
440 $wgLogTypes[] = 'newusers';
441 $wgLogNames['newusers'] = 'newuserlogpage';
442 $wgLogHeaders['newusers'] = 'newuserlogpagetext';
443 $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
444 $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
445 $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
446 $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
447 $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
450 if ( $wgPageLanguageUseDB ) {
451 $wgLogTypes[] = 'pagelang';
452 $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
455 if ( $wgCookieSecure === 'detect' ) {
456 $wgCookieSecure = ( WebRequest
::detectProtocol() === 'https' );
459 // Back compatibility for $wgRateLimitLog deprecated with 1.23
460 if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
461 $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
464 if ( $wgProfileOnly ) {
465 $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
466 $wgDebugLogFile = '';
469 Profiler
::instance()->scopedProfileOut( $ps_default );
471 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
472 // all the memory from logging SQL queries on maintenance scripts
473 global $wgCommandLineMode;
474 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
478 if ( !class_exists( 'AutoLoader' ) ) {
479 require_once "$IP/includes/AutoLoader.php";
482 MWExceptionHandler
::installHandler();
484 require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
486 $ps_default2 = Profiler
::instance()->scopedProfileIn( $fname . '-defaults2' );
488 if ( defined( 'MW_ENTRY_PHP5' ) ) {
489 wfWarn( 'The ".php5" entry point files are deprecated. Use ".php" instead.' );
492 if ( $wgCanonicalServer === false ) {
493 $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP
);
497 $serverParts = wfParseUrl( $wgCanonicalServer );
498 if ( $wgServerName !== false ) {
499 wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
500 . 'not customized. Overwriting $wgServerName.' );
502 $wgServerName = $serverParts['host'];
503 unset( $serverParts );
505 // Set defaults for configuration variables
506 // that are derived from the server name by default
507 if ( $wgEmergencyContact === false ) {
508 $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
511 if ( $wgPasswordSender === false ) {
512 $wgPasswordSender = 'apache@' . $wgServerName;
515 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
516 $wgSecureLogin = false;
517 wfWarn( 'Secure login was enabled on a server that only supports '
518 . 'HTTP or HTTPS. Disabling secure login.' );
521 // Now that GlobalFunctions is loaded, set defaults that depend on it.
522 if ( $wgTmpDirectory === false ) {
523 $wgTmpDirectory = wfTempDir();
526 // We don't use counters anymore. Left here for extensions still
527 // expecting this to exist. Should be removed sometime 1.26 or later.
528 $wgDisableCounters = true;
530 if ( $wgMainWANCache === false ) {
531 // Setup a WAN cache from $wgMainCacheType with no relayer.
532 // Sites using multiple datacenters can configure a relayer.
533 $wgMainWANCache = 'mediawiki-main-default';
534 $wgWANObjectCaches[$wgMainWANCache] = array(
535 'class' => 'WANObjectCache',
536 'cacheId' => $wgMainCacheType,
537 'pool' => 'mediawiki-main-default',
538 'relayerConfig' => array( 'class' => 'EventRelayerNull' )
542 Profiler
::instance()->scopedProfileOut( $ps_default2 );
544 $ps_misc = Profiler
::instance()->scopedProfileIn( $fname . '-misc1' );
546 // Raise the memory limit if it's too low
550 * Set up the timezone, suppressing the pseudo-security warning in PHP 5.1+
551 * that happens whenever you use a date function without the timezone being
552 * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
554 if ( is_null( $wgLocaltimezone ) ) {
555 wfSuppressWarnings();
556 $wgLocaltimezone = date_default_timezone_get();
560 date_default_timezone_set( $wgLocaltimezone );
561 if ( is_null( $wgLocalTZoffset ) ) {
562 $wgLocalTZoffset = date( 'Z' ) / 60;
565 if ( !$wgDBerrorLogTZ ) {
566 $wgDBerrorLogTZ = $wgLocaltimezone;
569 // Useful debug output
570 if ( $wgCommandLineMode ) {
571 $wgRequest = new FauxRequest( array() );
573 wfDebug( "\n\nStart command line script $self\n" );
575 // Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
576 $wgRequest = new WebRequest
;
578 $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
580 if ( $wgDebugPrintHttpHeaders ) {
581 $debug .= "HTTP HEADERS:\n";
583 foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
584 $debug .= "$name: $value\n";
590 Profiler
::instance()->scopedProfileOut( $ps_misc );
591 $ps_memcached = Profiler
::instance()->scopedProfileIn( $fname . '-memcached' );
593 $wgMemc = wfGetMainCache();
594 $messageMemc = wfGetMessageCacheStorage();
595 $parserMemc = wfGetParserCacheStorage();
597 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
598 ', message: ' . get_class( $messageMemc ) .
599 ', parser: ' . get_class( $parserMemc ) );
601 Profiler
::instance()->scopedProfileOut( $ps_memcached );
603 // Most of the config is out, some might want to run hooks here.
604 Hooks
::run( 'SetupAfterCache' );
606 $ps_session = Profiler
::instance()->scopedProfileIn( $fname . '-session' );
608 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
609 // If session.auto_start is there, we can't touch session name
610 if ( !wfIniGetBool( 'session.auto_start' ) ) {
611 session_name( $wgSessionName ?
$wgSessionName : $wgCookiePrefix . '_session' );
614 if ( $wgRequest->checkSessionCookie() ||
isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) {
619 Profiler
::instance()->scopedProfileOut( $ps_session );
620 $ps_globals = Profiler
::instance()->scopedProfileIn( $fname . '-globals' );
623 * @var Language $wgContLang
625 $wgContLang = Language
::factory( $wgLanguageCode );
626 $wgContLang->initEncoding();
627 $wgContLang->initContLang();
629 // Now that variant lists may be available...
630 $wgRequest->interpolateTitle();
635 $wgUser = RequestContext
::getMain()->getUser(); // BackCompat
638 * @var Language $wgLang
640 $wgLang = new StubUserLang
;
643 * @var OutputPage $wgOut
645 $wgOut = RequestContext
::getMain()->getOutput(); // BackCompat
648 * @var Parser $wgParser
650 $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
652 if ( !is_object( $wgAuth ) ) {
653 $wgAuth = new AuthPlugin
;
654 Hooks
::run( 'AuthPluginSetup', array( &$wgAuth ) );
658 * @var Title $wgTitle
663 * @deprecated since 1.24 Use DeferredUpdates::addUpdate instead
666 $wgDeferredUpdateList = array();
668 Profiler
::instance()->scopedProfileOut( $ps_globals );
669 $ps_extensions = Profiler
::instance()->scopedProfileIn( $fname . '-extensions' );
671 // Extension setup functions for extensions other than skins
672 // Entries should be added to this variable during the inclusion
673 // of the extension file. This allows the extension to perform
674 // any necessary initialisation in the fully initialised environment
675 foreach ( $wgExtensionFunctions as $func ) {
676 // Allow closures in PHP 5.3+
677 if ( is_object( $func ) && $func instanceof Closure
) {
678 $profName = $fname . '-extensions-closure';
679 } elseif ( is_array( $func ) ) {
680 if ( is_object( $func[0] ) ) {
681 $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
683 $profName = $fname . '-extensions-' . implode( '::', $func );
686 $profName = $fname . '-extensions-' . strval( $func );
689 $ps_ext_func = Profiler
::instance()->scopedProfileIn( $profName );
690 call_user_func( $func );
691 Profiler
::instance()->scopedProfileOut( $ps_ext_func );
694 wfDebug( "Fully initialised\n" );
695 $wgFullyInitialised = true;
697 Profiler
::instance()->scopedProfileOut( $ps_extensions );
698 Profiler
::instance()->scopedProfileOut( $ps_setup );